Skip to content

Comments

Handle "internal" directory visibility#274

Merged
achew22 merged 1 commit intobazelbuild:masterfrom
achew22:visibility
Oct 22, 2020
Merged

Handle "internal" directory visibility#274
achew22 merged 1 commit intobazelbuild:masterfrom
achew22:visibility

Conversation

@achew22
Copy link
Member

@achew22 achew22 commented Sep 14, 2020

Both "internal" and "private" directories should be treated the same way
and have visibility restrictions be placed upon them.

@achew22
Copy link
Member Author

achew22 commented Sep 14, 2020

@jayconrod and @segiddins, could I have you both take a look at this one also. I believe this addresses the last issue that @segiddins ran into when using this in rules_swift. If that's not the case, please help me see the things that I am missing so I can make this as easy to use as possible.

Thanks so much!

Once you two LGTM I will send off to someone from the skylib team for a last review.

Copy link
Contributor

@jayconrod jayconrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with a couple minor comments.

// so it can't be used verbatim, but with slight modifications it can be.
// https://github.com/bazelbuild/bazel-gazelle/blob/2078a44d2bba287db98b2b48b5f6cf4f08642489/rule/rule.go#L833:6
func checkInternalVisibility(rel, visibility string) string {
rel = rel + "/" // Append a / to make finding the suffix easier.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use github.com/bazelbuild/bazel-gazelle/pathtools.Index instead? It's like strings.Index, but it only matches on path component boundaries.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the change and it is passing tests so I believe it is equivalent. The only reason I didn't use pathtools.Index instead from the start is because it wasn't looking for the LastIndex and I didn't want it to turn /foo/internal/bar/internal into being visible to //foo:__subpackages__

@achew22
Copy link
Member Author

achew22 commented Sep 16, 2020

@jayconrod with the submission of the CODEOWNERS I anticipate you should now have permission to approve. Could I have you give it one more poke just to make sure it is actually working now.

Thanks again!

@achew22
Copy link
Member Author

achew22 commented Oct 19, 2020

@jayconrod could you try approving this one more time now that we've updated the CODEOWNERS?

Copy link
Contributor

@jayconrod jayconrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still LGTM

@jayconrod
Copy link
Contributor

Actually, a couple updates are needed.

  • "This branch is out-of-date with the base branch". Not sure if there are conflicts, I'd guess it just needs to be updated.
  • Tests are failing at tip.
  • "At least 1 approving review is required by reviewers with write access." I don't have write access, and I don't think CODEOWNERS grants it. Someone on the Bazel team needs to merge or grant us write access. I can ping someone when the other two things are done.

@achew22
Copy link
Member Author

achew22 commented Oct 20, 2020

@c-parsons would it be possible to add writer permissions to either (or both) me and @jayconrod

@c-parsons
Copy link
Collaborator

@achew22 you have already had write permissions for the github repo. I've added @jayconrod now.

Both "internal" and "private" directories should be treated the same way
and have visibility restrictions be placed upon them.
@achew22 achew22 merged commit 182046f into bazelbuild:master Oct 22, 2020
@achew22 achew22 deleted the visibility branch October 22, 2020 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants